﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="AndCompoundCondition.cs" company="Microsoft">
//   Microsoft
// </copyright>
// <summary>
//   Defines the AndCompoundCondition type.
// </summary>
// Copyright (c) Microsoft Corporation. All rights reserved.
// 
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES 
// OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
// ----------------------------------------------------------------------------------
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious.  No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
// --------------------------------------------------------------------------------------------------------------------

namespace MySemanticSearch.Web.QueryBuilder.Conditions
{
    /// <summary>
    /// This condition handles the "and" of two conditions
    /// </summary>
    public class AndCompoundCondition : CompoundCondition
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="AndCompoundCondition"/> class.
        /// </summary>
        /// <param name="left">
        /// The left condition
        /// </param>
        /// <param name="right">
        /// The right condition
        /// </param>
        public AndCompoundCondition(ICondition left, ICondition right)
            : base(left, right)
        {
        }

        /// <summary>
        /// Gets a condition compoused by an and of two other conditions
        /// </summary>
        /// <returns>
        /// An and between two conditions
        /// </returns>
        public override string GetCondition()
        {
            return this.LeftCondition.GetCondition() + " AND " +
            RightCondition.GetCondition();
        }
    }
}